import request from "@/utils/request";

/**
 * 获取权限路由数据
 * @returns {Promise<any>}
 */
export async function getPermissionData() {
  return request('/admin/permission?include=childes')
}

/**
 * 获取权限路由详情
 * @param id
 * @returns {Promise<any>}
 * @constructor
 */
export async function permissionDetail(id) {
  return request(`/admin/permission/${id}`)
}

/**
 * 添加
 * @param data
 * @returns {Promise<any>}
 */
export async function addPermissionData(data) {
  return request.post('/admin/permission',{data})
}

/**
 * 修改
 * @param cid
 * @param data
 * @returns {Promise<any>}
 */
export async function updatePermission(uid,data) {
  return request.put(`/admin/permission/${uid}`,{data})
}

/**
 * 删除
 * @param id
 * @returns {Promise<any>}
 */
export async function deletePermissionData(id) {
  return request.delete(`/admin/permission/${id}`)
}
